1. Field of the Invention
The present invention relates to a tabulation device which, when performing tabulation based on given information, automatically assigns the information into a table.
2. Description of the Prior Art
In recent days in a document processing system, tabulation function has been become indispensable. In a prior simple system, a user draws ruled lines to arrange text into each cell of the partitioned table. In such a system, if either the text overflows the cell or there is too much blank space, the user should redraw the ruled lines to rearrange the form of the table. The user is forced to perform trial and error and to spend wasted time.
In order to make a table, one has to determine the height of each row and the width of each column of the table to fill the cells with text by line-breaking in accordance with either the column width for side-by-side writing or with the row height for up-to-down writing. The height of rows and the width of columns of the table will be determined by a variety of conditions such as text to be lay out, and the size of the entire table.
In the methods of tabulation in the prior art, these conditions are adjusted and determined by a user such that the success of making a table depends on the ability of the user, therefore a user might not be able to achieve a table, or might spend enough labor. Thus a system which may automatically determine the height of the row and the width of the column in a table will have significant merits for any user.
Even though the merit is clear, commonly used systems does not provide a function for achieving both automatic adjustment of the height of rows and the width of columns of a table and automatic line-breaking. The reason is based on the technical problems as described below.
The coexistence of automatic adjustment of the vertical intervals (height of rows) and automatic line-breaking, when the horizontal intervals (width of column) is predefined, has been already implemented. In such system as J-Star (registered trade mark), LaTeX, and Interleaf5 (trade mark), this function is achieved by the method as describedbelow. At first, line-breaking of the text is calculated by filling a cell with text string so as to fit the string into the predefined cell width (sum of the width of rows to which the cell intersects). Based on the calculated line-breaking, the height of the text string is determined. Then, the minimum vertical interval is calculated so as for the height of the cell to be larger than the height of the fulfilling text string. In such a manner, the determination of the vertical interval and the line-breaking of the text string may be automatically performed in the case in which the horizontal interval is predefined.
On the other hand, it is not easy to automatically determine the column width, the row height, and the line-breaking of fulfilling text string in comparison with the case, as described above, in which the column width is predefined. FIGS. 2, 3 and 4 are schematic diagrams illustrating an exemplary table. The table shown in FIGS. 2 to 4 is a simple table which contains four cells. d1 and d2 designate the widths of the first and the second columns, respectively, and it is assumed that any value may be taken under the condition of d1+d2=(d), where d is a constant determined from the page width or so.
As mentioned above, once the column width is defined, the height of row and the line-breaking of the text string may be automatically determined. However, it is to be noted that there are infinite ways of how to define the column width. For example, it is possible to have d1=0.5d as shown in FIG. 2, or it also is possible to have d1=0.2d as shown in FIG. 3, or it is possible further to have d1=0.8d as shown in FIG. 4. Therefore in order to determine the column width, some conditions should be predefined so as to be able to select ones which may satisfy the conditions among infinite ways of determining the column width.
However, even if a condition, such as "shrink area as small as possible" is defined, there arises a problem here how to find the best way to determine the column width satisfying the condition.
There has been disclosed means for solving this problem in Japanese Published Unexamined Patent Application No. Hei 3-38774 and No. Hei 7-334490. Here the method described in the Japanese Published Unexamined Application No. Hei 3-38774 will be explained first. In this patent, when a user alters the size of a cell, the height of the row which includes the cell will be assumed to be the height of the cell, and the width of the column will be assumed to be the width of the cell. Once defined the height of the row, for each cell contained in the row, the minimumwidth for text string in the cell will be determined and this width is made to be the width of each cell. In a similar way, the height of the cell within the column will be determined from the column width. This allows the height/width of total row/column in the table to be determined. If there is a cell overflowing the text string, the size of the cell will be adjusted so as to contain the string.
The method described in the Japanese Published Unexamined Patent Application No. Hei 3-38774 requires for the cell size of reference to be given at first, thus there is a problem that the row height, column width, and line-breaking may not be calculated in a fully automatic manner. In addition, for determining the width of an other cell within the same row to the reference cell, the cell width just fitting to the text string is sought by increasing or decreasing the cell width by the size of one character. This method cannot be applied to the case in which the size of characters varies in the text string. Furthermore, it poses problems that it takes a number of steps to achieve to a desired cell width because the cell width is altered one by one in a step even when the cell width is to be significantly altered.
Next, the method disclosed in the Japanese Published Unexamined Patent Application No. Hei 7-334490 will be described. Its line-breaking function will be described first. Here it is assumed that text "T" is fixed and then it is considered how to fit text "T" into a rectangular area. The line breaking function "f" of the text "T" is a function which maps a width "W" of a rectangular area to the minimum height "H" of the area required for laying out the text "T". It should be noted that the definition range of the function "f" is 0.ltoreq.H, and a special value ".perp." is returned for the unallocatable "H".
FIG. 5 shows an example of the line-breaking function. In this figure, there is shown the line-breaking function for the text string of fixed pitch, uniform character size, and the length of text string "9". As shown in FIG. 5, the line-breaking function is a step function. That is, for width "W" of the rectangular area to be laid out with the string, there are values W.sub.i. and W.sub.i+1, and the height of the rectangular area will not be altered in the range W.sub.i .ltoreq.W&lt;W.sub.i+1. Then the width of the rectangular area becomes smaller than a predetermined width, line-breaking will be occurred to increase the height of the rectangular area. Also, the height of the rectangular area will be constant until the width becomes smaller than another predetermined value since the amount of blank space within the text string is adjusted.
In this example the character size in the text string is uniform. Although the line-breaking function is the step function as shown in FIG. 5 even when the character size is not constant, it is not always limited to a decreasing function. In the following description, a line-breaking function which returns height for the width of the rectangular area is used by way of example, a line-breaking function returning width for the height also may be used instead.
The tabulation device according to Japanese Published Unexamined Patent Application No. Hei 7-334490 classifies the cases based on which the step height of step function corresponds to each text string. Then if the width of each column of the table is a parameter, since the text height is made uniform in each respective case and thus, the area of each cell may be expressed in a linear equation of these parameters. This means that the area of the table (=sum of the area of each cell) may also be expressed in a linear equation of these parameters. By using this, the way how to select parameters so as to minimize the area of the table, in other words, the way how to select column widths so as to minimize the area of the table in that case, may be determined by the linear programming method. In each classified case as above, the way to select column widths so as to minimize the table area will be respectively determined and thereafter, by comparing them, the best way to select column width so as to minimize the table area among them will be adopted.
The method disclosed in the Japanese Published Unexamined Patent Application No. Hei 7-334490 allows the way to select column width strictly minimizing the area of the table. Moreover, it allows users to specify arbitrary linear equations of the parameters (column widths), such that for example, a limitation such as "the width of table is to be less than or equal to 50 mm" may be arbitrarily set. However, in the case that the text string becomes long so that the number of steps of the line-breaking function increases, or in the case that the number of the text string in the table increases, the number of classified branch may become in the order of thousands or tenth of thousands and, in addition, a linear programming method which has high computing costs has to be solved for each case. This results in that this method has the problem of very high costs for tabulation.